import 'package:flutter/cupertino.dart';
import 'package:go_router/go_router.dart';
import 'package:untitled1/main.dart';
import 'package:untitled1/pages/home/view/login.dart';

/// 构造一个全局路由观察者
class GlobalNavigatorObserver extends NavigatorObserver {
  static GlobalNavigatorObserver instance = GlobalNavigatorObserver();
}

var router = GoRouter(
  observers: [
    GlobalNavigatorObserver.instance,
  ],
  initialLocation: '/',
  debugLogDiagnostics: true,
  routes: [
    GoRoute(
      path: '/',
      builder: (context, state) => const HomePage(),
    ),
    GoRoute(
      name: 'login',
      path: '/login',
      builder: (context, state) => const LoginPage(),
    ),
  ],
);
